/*
 * MusicPlayer.h
 *
 *  Created on: 2010-09-22
 *      Author: Administrateur
 *
 * This class REALLY needs to be a singleton.
 */

#ifndef MUSICPLAYER_H_
#define MUSICPLAYER_H_

#include <pspmp3.h>
#include <pspkerneltypes.h>

class Epik_MusicPlayer // Only songs with 256 or 192kbps
{
	bool *running_;
	SceUID thid_;
	int file_;
	int handle_;

	int channel_;
	int samplingRate_;
	int numChannels_;
	int lastDecoded_;
	int volume_;
	int numPlayed_;

	bool playing_;
	bool paused_;
	bool loop_;

	char mp3Buf_[16*1024] __attribute__((aligned(64)));			//16k buffer	(file buffer)
	short pcmBuf_[16*(1152/2)] __attribute__((aligned(64)));	//9k buffer	(spkr buffer)

	SceMp3InitArg mp3Init_;

public:
	Epik_MusicPlayer(bool *run);
	~Epik_MusicPlayer();

	void Run();

	void Play();
	void Pause();
	void Stop();
//	void Loop(bool l);
};

#endif /* MUSICPLAYER_H_ */
